package com.sinosoft.system.bank.biz.imp;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinosoft.system.bank.biz.BankTradeBiz;
import com.sinosoft.system.bank.dao.BankTradeDao;
import com.sinosoft.system.bank.entity.BankTrade;
import com.sinosoft.system.util.page.Pagenation;

@Service
@Transactional
public class BankTradeBizImp implements BankTradeBiz{

	private static Logger log = Logger.getLogger(BankTradeBizImp.class);
	
	@Autowired
	private BankTradeDao bankTradeDao;
	
	@Override
	public int insertBankTrade(BankTrade bankTrade) {
		log.info("新增BankTrade数据"+bankTrade.toString());
		return bankTradeDao.insertBankTrade(bankTrade);
	}

	@Override
	public int updateBankTrade(BankTrade bankTrade) {
		log.info("更新BankTrade数据"+bankTrade.toString());
		return bankTradeDao.updateBankTrade(bankTrade);
	}

	@Override
	public int deleteBankTrade(int id) {
		log.info("删除BankTrade数据 id="+id);
		return bankTradeDao.deleteBankTrade(id);
	}

	@Override
	public BankTrade selectBankTrade(int id) {
		log.info("根据ID查询BankTrade数据 id="+id);
		return bankTradeDao.selectBankTrade(id);
	}

	@Override
	public BankTrade selectBankTrade(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询BankTrade数据 ");
		return bankTradeDao.selectBankTrade(queryKeys, queryValues);
	}

	@Override
	public int selectCountBankTrade() {
		log.info("查询BankTrade数据 总数量");
		return bankTradeDao.selectCountBankTrade();
	}

	@Override
	public int selectCountBankTrade(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询BankTrade数据 总数量"+queryKeys.toString());
		return bankTradeDao.selectCountBankTrade(queryKeys, queryValues);
	}

	@Override
	public List<BankTrade> selectLimitBankTrade(int start, int size) {
		log.info("查询BankTrade数据 limit数量:start="+start+",size="+size);
		return bankTradeDao.selectLimitBankTrade(start, size);
	}

	@Override
	public List<BankTrade> selectLimitBankTrade(List<String> queryKeys,List<Object> queryValues,int start, int size) {
		log.info("条件查询BankTrade数据数量");
		return bankTradeDao.selectLimitBankTrade(queryKeys, queryValues, start,  size);
	}

	@Override
	public List<BankTrade> selectAllBankTrade() {
		log.info("查询所有BankTrade数据");
		return bankTradeDao.selectAllBankTrade();
	}

	@Override
	public List<BankTrade> selectAllBankTrade(List<String> queryKeys,List<Object> queryValues) {
		log.info("条件查询所有BankTrade数据");
		return bankTradeDao.selectAllBankTrade(queryKeys, queryValues);
	}

	@Override
	public Pagenation selectPageBankTrade(Pagenation page) {
		log.info("分页查询所有BankTrade数据");
		int start =	page.getStartRow();
		int size = page.getPageSize();
		List<BankTrade> rows = bankTradeDao.selectLimitBankTrade(page.getQueryKeys(), page.getQueryValues(),start,size);
		int total = bankTradeDao.selectCountBankTrade(page.getQueryKeys(), page.getQueryValues());
		page.setTotal(total);
		page.setRows(rows);
		return page;
	}

	public BankTradeDao getBankTradeDao() {
		return bankTradeDao;
	}

	public void setBankTradeDao(BankTradeDao bankTradeDao) {
		this.bankTradeDao = bankTradeDao;
	}

}
